url = 'https://www.acwing.com/problem/content/4810/'

m, s = map(int, input().split())

res_a = [0] * m
res_b = [8] * m

if (s == 0 and m > 1) or s > m * 9:
    print('-1 -1')
else:
    # 最小值
    sum = s
    for i in range(m - 1, 0, -1):
        t = min(9, sum - 1)
        res_a[i] = str(t)
        sum -= t
    res_a[0] = str(sum)
    # 求最大值
    sum = s
    for i in range(m):
        t = min(9, sum)
        res_b[i] = str(t)
        sum -= t
    # print(res_a,res_b)
    print(''.join(res_a), ''.join(res_b))
